<template>
  <k-view class="stock-score-read">
    <k-text class="score-read-text">{{ scoreReadAbstract }}{{ scoreReadText }}</k-text>
  </k-view>
</template>

<script>
import { SYSTEM_READ } from '@/scripts/scoreDetail';

const defaultOverViewInfo = {
  composite_score: 0,
  urinary_score: 0,
  immune_score: 0,
  motor_score: 0,
  respiratory_score: 0,
  circulatory_score: 0,
  market_rank: 0,
  composite_score_label: '基本面优秀',
  industry_rank_inc: 0,
  secretion_score: 0,
  company_num: 0,
  market_rank_inc: 0,
  nervous_score: 0,
  digesive_score: 0,
  reproductive_score: 0,
  score_inc: 0,
  industry_rank: 0,
  report_date: '20220930',
};

export default {
  props: {
    companyOverview: {
      type: Object,
      default: defaultOverViewInfo,
    },
    stockInfo: {
      type: Object,
      default: {
        market: '',
        code: '',
        score: '',
        name: '',
      },
    },
  },
  computed: {
    scoreReadText() {
      const data = SYSTEM_READ.fundamentals_score[this.companyOverview?.composite_score_label];
      return data ? data.content : this.companyOverview.composite_score_label;
    },
    scoreReadAbstract() {
      return `${this.stockInfo.name}综合健康指数为${this.stockInfo.score}，在行业中排名${this.companyOverview.industry_stock_rank}/${this.companyOverview.industry_stock_num}，`;
    },
  },
};
</script>

<style lang="less">
.stock-score-read {
  background-color: #f7f7f9;
  padding: 18px 24px;
  margin: 32px 0px;
  box-sizing: border-box;
  border-radius: 8px;

  .score-read-text {
    font-size: 26px;
    color: rgba(0, 0, 0, 0.6);
    font-weight: 400;
  }
}

[theme-mode='black'] {
  .stock-score-read {
    background-color: #212121;
  }
  .score-read-text {
    color: rgba(255, 255, 255, 0.6);
  }
}
</style>
